package cc.web.vaaking.common;

import cc.web.vaaking.entity.SysRole;
import cc.web.vaaking.entity.SysUser;
import cn.hutool.core.date.DateTime;
import lombok.Data;

@Data
public class LoginUser {
    private SysUser sysUser;

    private DateTime loginTime;

    public LoginUser() {
    }

    public LoginUser(SysUser sysUser) {
        this.sysUser = sysUser;
        this.loginTime = new DateTime();
    }

    public String getRole(){
        return sysUser.getSysRole().getRole();
    }

    public String getUsername() {
        return sysUser.getUsername();
    }

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public DateTime getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(DateTime loginTime) {
        this.loginTime = loginTime;
    }

    public int getRoleId() {
        return sysUser.getSysRole().getId();
    }

    public Integer getId() {
        return sysUser.getId();
    }
}
